home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun: Productivity Pak 1
/
rerun-productivity-pak-i.d64
/
finance aid
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
8KB
|
283 lines
1 rem*******************
2 rem home finance aid
3 rem*******************
40 print"[147]"chr$(14): rem set upper/lower case
50 sc=53281:bc=53280: rem screen color address, border color address
60 am=0:ir=0:ny=0: rem amount, interest rate, # of years
65 py=0:vy=0: rem # of payments, investments per year
70 gosub9000: rem set sound parameters
75 ll$="": rem last line
80 gosub9300: rem print instructions
100 rem************
101 rem main menu
102 rem************
105 print"[147]";:pokesc,7:pokebc,7
107 printtab(3)" "
110 printtab(3)" [200][160][207][160][205][160][197][160][160][160][198][160][201][160][206][160][193][160][206][160][195][160][197] [193][160][201][160][196] "
115 printtab(3)" "
120 printtab(4)"[151]f1[146]-[196]etermine [208]ayment for a loan"
140 printtab(4)"f3[146]-[195]alculate [198]uture [214]alue of an"
150 printtab(7)"[201]nvestment"
170 printtab(4)"f5[146]-[195]alculate [198]uture [214]alue of an"
180 printtab(7)"[197]qual [208]eriodic [201]nvestment"
190 printtab(4)"[151]f6[146]-[208]rint [200]ardcopy [201]mage of"
195 printtab(7)"[195]urrent [211]creen"
200 printtab(4)"f7[146]-[197]nd"
210 geto$:ifo$=""then210
220 ifo$=chr$(133)thengosub9100:gosub1000:goto100
230 ifo$=chr$(134)thengosub9100:gosub2000:goto100
240 ifo$=chr$(135)thengosub9100:gosub3000:goto100
245 ifo$=chr$(139)thengosub9100:gosub60000:goto100
250 ifo$=chr$(136)thengosub9100:print"[147]":end
260 gosub9200
270 goto210
1000 print"[147]";:pokesc,11:pokebc,3
1005 printll$tab(28)"[158]f7[146]-[205]enu"
1010 printtab(6)"[158][196][197][212][197][210][205][201][206][197][160][208][193][217][205][197][206][212][160][198][207][210][160][193][160][204][207][193][206]"
1030 printtab(13)"[158][204]oan [193]mount ";
1035 n=am:gosub8000
1040 ifd$=chr$(136)thenreturn
1045 am=n
1050 printtab(4)"[158][193]nnual [201]nterest [210]ate ";
1055 n=ir:gosub8000
1060 ifd$=chr$(136)thenreturn
1065 ir=n
1080 printtab(9)"[158][206]umber of [217]ears ";
1085 n=ny:gosub8000
1090 ifd$=chr$(136)thenreturn
1095 ny=n
1100 printtab(7)"[158][208]ayments per [217]ear ";
1105 n=py:gosub8000
1110 ifd$=chr$(136)thenreturn
1115 py=n
1130 i=ir/py/100
1135 ifi=0theni=1
1140 ca=am/((1-1/(1+i)^(py*ny))/i)
1150 printtab(10)"[158][208]ayment [193]mount[153]";:n=ca:gosub8300
1160 printtab(11)"[158][201]nterest [208]aid[153]";:n=(ca*py*ny)-am:gosub8300
1170 printll$tab(5)"[158]f1[146]-[193]gain f6[146]-[200]ardcopy f7[146]-[205]enu"
1180 geto$:ifo$=""then1180
1190 ifo$=chr$(133)thengosub9100:goto1000
1195 ifo$=chr$(139)thengosub9100:gosub60000:goto1180
1200 ifo$=chr$(136)thengosub9100:return
1210 gosub9200:goto1180
2000 print"[147]":pokesc,12:pokebc,12
2005 printll$tab(28)"f7[146]-[205]enu"
2010 printtab(9)"[144][195][193][204][195][213][204][193][212][197][160][198][213][212][213][210][197][160][214][193][204][213][197]"
2020 printtab(12)"[207][198][160][193][206][160][201][206][214][197][211][212][205][197][206][212]"
2030 printtab(12)"[201]nvestment [193]mount ";
2035 n=am:gosub8000
2040 ifd$=chr$(136)thenreturn
2045 am=n
2060 printtab(9)"[193]nnual [201]nterest [210]ate ";
2075 n=ir:gosub8000
2080 ifd$=chr$(136)thenreturn
2085 ir=n
2090 printtab(14)"[206]umber of [217]ears ";
2095 n=ny:gosub8000
2100 ifd$=chr$(136)thenreturn
2105 ny=n
2110 printtab(4)"[201]nterest [208]eriods per [217]ear ";
2115 n=py:gosub8000
2120 ifd$=chr$(136)thenreturn
2125 py=n
2140 i=ir/py/100
2150 ca=am*((1+i)^(py*ny))
2160 printtab(17)"[198]uture [214]alue[158]";:n=ca:gosub8300
2180 printtab(14)"[201]nterest [197]arned[158]";:n=ca-am:gosub8300
2190 printll$tab(5)"f1[146]-[193]gain f6[146]-[200]ardcopy f7[146]-[205]enu"
2200 geto$:ifo$=""then2200
2210 ifo$=chr$(133)thengosub9100:goto2000
2215 ifo$=chr$(139)thengosub9100:gosub60000:goto2200
2220 ifo$=chr$(136)thengosub9100:return
2230 gosub9200:goto2200
3000 print"[147]":pokesc,4:pokebc,4
3005 printll$tab(28)"[144]f7[146]-[205]enu"
3010 printtab(3)"[144][195][193][204][195][213][204][193][212][197][160][198][213][212][213][210][197][160][214][193][204][213][197] [207][198][160][193][206][160][197][209][213][193][204]"
3020 printtab(10)"[208][197][210][201][207][196][201][195][160][201][206][214][197][211][212][205][197][206][212]"
3030 printtab(12)"[144][201]nvestment [193]mount ";
3035 n=am:gosub8000
3040 ifd$=chr$(136)thenreturn
3045 am=n
3060 printtab(9)"[144][193]nnual [201]nterest [210]ate ";
3065 n=ir:gosub8000
3070 ifd$=chr$(136)thenreturn
3075 ir=n
3090 printtab(14)"[144][206]umber of [217]ears ";
3095 n=ny:gosub8000
3100 ifd$=chr$(136)thenreturn
3105 ny=n
3110 printtab(9)"[144][201]nvestments per [217]ear ";
3115 n=vy:gosub8000
3120 ifd$=chr$(136)thenreturn
3125 vy=n
3140 printtab(4)"[144][201]nterest [208]eriods per [217]ear ";
3145 n=py:gosub8000
3150 ifd$=chr$(136)thenreturn
3155 py=n
3170 i=ir/py/100
3180 ifvy>=pythenca=(am*(vy/py))*((((1+i)^(py*ny+1)-1)/i)-1)
3190 ifvy<pythengosub3500
3200 printtab(11)"[144][193]mount [201]nvested[158]";:n=am*vy*ny:gosub8300
3210 printtab(14)"[144][198]uture [214]alue[158]";:n=ca:gosub8300
3230 printtab(11)"[144][201]nterest [197]arned[158]";:n=ca-(am*vy*ny):gosub8300
3240 printll$tab(5)"[144]f1[146]-[193]gain f6[146]-[200]ardcopy f7[146]-[205]enu"
3250 geto$:ifo$=""then3250
3260 ifo$=chr$(133)thengosub9100:goto3000
3265 ifo$=chr$(139)thengosub9100:gosub60000:goto3250
3270 ifo$=chr$(136)thengosub9100:return
3280 gosub9200:goto3250
3500 ca=am:x=1:ms=-1
3505 tm$=ti$
3510 form=0to((py*ny)-1)
3520 ca=ca*(1+i)
3530 ifint(m*(vy/py))=xthenca=ca+am:x=x+1
3540 iftm$=ti$thennext:ms=0
3550 ifms=-1thenprinttab(8)" [195]alculation in [208]rocess [145]"
3560 ifms=1thenprinttab(8)" [145]"
3570 ms=ms*(-1)
3580 tm$=ti$
3585 ifms<>0thennext
3587 printtab(8)" [145]"
3590 return
8000 rem************************
8001 rem get numeric value in n
8002 rem************************
8005 sd$="y": rem decimal point switch
8010 n$="" : rem number string
8015 x=0:ms=1: rem flash cursor counter and switch
8020 getd$:ifd$<>""thenprint" [157]";:goto8045
8025 x=x+1:ifx<>15then8020
8030 ifms=1thenprint" [157][146]";
8035 ifms=-1thenprint" [157]";
8040 ms=ms*-1:x=0:goto8020
8045 ifd$=chr$(20)thengosub8400:goto8020
8050 ifd$=chr$(136)thengosub9100:return
8055 ifd$=chr$(13)andn$=""then8150
8060 ifd$=chr$(13)then8200
8065 ifd$<>"."and(d$<"0"ord$>"9")thengosub9200:goto8020
8070 ifd$="."andsd$="n"thengosub9200:goto8020
8080 ifd$="."thensd$="n"
8085 iflen(n$)=9thengosub9200:goto8020
8090 printd$;
8100 gosub9100
8110 n$=n$+d$
8120 goto8020
8150 rem*********************
8151 rem use previous value
8152 rem*********************
8160 n$=right$(str$(n),(len(str$(n))-1))
8170 printn$;
8200 rem*********************************************************
8201 rem if value is zero, display message and go back for data
8202 rem*********************************************************
8210 ifval(n$)<>0thenn=val(n$):print:gosub9100:return
8220 print"[218]ero is invalid[146]";:gosub9200
8230 form=1to1000:next
8240 print"[157][157][157][157][157][157][157][157][157][157][157][157][157][157][157] ";
8250 print"[157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]";
8260 goto8020
8300 rem************************************
8301 rem round n to nearest cent and print
8302 rem************************************
8310 ifn<.005thenprint" .00":return
8320 n$=str$(n+.005)
8330 x=1
8340 ifmid$(n$,x,1)<>"."thenx=x+1:ifx<8then8340
8350 printleft$(n$,(x+2))
8360 return
8400 rem************************************
8401 rem delete previous character routine
8402 rem************************************
8405 ifn$=""thengosub9200:goto8490
8410 gosub9100
8420 print"[157][160][157]";
8425 ifright$(n$,1)="."thensd$="y"
8430 n$=left$(n$,(len(n$)-1))
8490 return
9000 rem***********************
9001 rem set sound parameters
9002 rem***********************
9010 s=54272
9015 forx=0to24
9020 pokes+x,0: rem clear sid registers
9025 next
9030 pokes+0,135: rem set voice